<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>管理端测试页</title>
    <script src="../js/jquery.min.js"></script>
    <style>
        div {
            margin: 5px 0;
        }
    </style>
</head>
<body>
<div>
    <input type="button" id="login" value="登陆">
</div>
<div>
    <input type="button" id="editPassword" value="修改密码">
</div>
<div>
    <input type="button" id="logout" value="注销">
</div>
<div>
    <input type="button" id="addInformationType" value="新增信息类型">
</div>
<div>
    <input type="button" id="updateInformationType" value="更新信息类型">
</div>
<div>
    <input type="button" id="getListInformationType" value="获取信息类型列表">
</div>
<div>
    <input type="button" id="addRole" value="新增角色">
</div>
<div>
    <input type="button" id="deleteRole" value="删除角色">
</div>
<div>
    <input type="button" id="updateRole" value="更新角色">
</div>
<div>
    <input type="button" id="getRole" value="获取角色">
</div>
<div>
    <input type="button" id="getListRole" value="获取角色列表">
</div>
<div>
    <input type="button" id="addRiskType" value="新增风险类型">
</div>
<div>
    <input type="button" id="updateRiskType" value="更新风险类型">
</div>
<div>
    <input type="button" id="getListRiskType" value="获取风险类型列表">
</div>
<div>
    <input type="button" id="addEventType" value="新增事件类型">
</div>
<div>
    <input type="button" id="updateEventType" value="更新事件类型">
</div>
<div>
    <input type="button" id="getListEventType" value="获取事件类型列表">
</div>
<div>
    <input type="button" id="distributeUserRole" value="人员分配角色">
</div>
<div>
    <input type="button" id="syncUser" value="同步DDIO用户">
</div>
<div>
    <input type="button" id="getListOrg" value="异步获取组织">
</div>
<div>
    <input type="button" id="getListRegion" value="获取地域列表">
</div>
<div>
    <input type="button" id="addRegion" value="新增地域">
</div>
<div>
    <input type="button" id="updateRegion" value="更新地域">
</div>
<div>
    <input type="button" id="getListIndustry" value="获取行业列表">
</div>
<div>
    <input type="button" id="addIndustry" value="新增行业">
</div>
<div>
    <input type="button" id="updateIndustry" value="更新行业">
</div>
</body>
<script type="text/javascript">
    $("#getListRegion").click(function () {
        $.ajax({
            type: 'get',
            url: '/Cyberspace/manage/region',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#addRegion").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/region',
            data: {
                name: ""
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#updateRegion").click(function () {
        $.ajax({
            type: 'put',
            url: '/Cyberspace/manage/region',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#getListIndustry").click(function () {
        $.ajax({
            type: 'get',
            url: '/Cyberspace/manage/industry',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#addIndustry").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/industry',
            data: {
                name: ""
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#updateIndustry").click(function () {
        $.ajax({
            type: 'put',
            url: '/Cyberspace/manage/industry',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#getListOrg").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/organizeTable/list',
            data: {
                orgID: 1,//根级下面的组织传1 ；其他的就传获取的orgID
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#syncUser").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/sync',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#distributeUserRole").click(function () {
        var orgIDs = ['12'];
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/distribute',
            data: {
                roleId: 2,
                orgIDs: JSON.stringify(orgIDs),
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#login").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/login',
            data: {
                username: "admin",
                password: "admin"
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#editPassword").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/editPassword',
            data: {
                oldPassword: "admin",
                newPassword: "admin"
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#logout").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/logout',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#addInformationType").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/informationType',
            data: {
                name: "888888" //类型名
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#updateInformationType").click(function () {
        $.ajax({
            type: 'put',
            url: '/Cyberspace/manage/informationType/6',
            data: {
                name: "888888" //类型名
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#getListInformationType").click(function () {
        $.ajax({
            type: 'get',
            url: '/Cyberspace/manage/informationType',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#addRole").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/role',
            data: {
                name: "测试", //角色名称
                roleRank: "ROLE_TEST", //角色等级
                roleType: "ROLE_TEST" //角色标识
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#updateRole").click(function () {
        $.ajax({
            type: 'put',
            url: '/Cyberspace/manage/role/6',
            data: {
                name: "测试", //角色名称
                roleRank: "ROLE_TEST", //角色等级
                roleType: "ROLE_TEST" //角色标识
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#getListRole").click(function () {
        $.ajax({
            type: 'get',
            url: '/Cyberspace/manage/role',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#addRiskType").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/riskType',
            data: {
                name: "888888" //类型名
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#updateRiskType").click(function () {
        $.ajax({
            type: 'put',
            url: '/Cyberspace/manage/riskType/6',
            data: {
                name: "888888" //类型名
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#getListRiskType").click(function () {
        $.ajax({
            type: 'get',
            url: '/Cyberspace/manage/riskType',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#addEventType").click(function () {
        $.ajax({
            type: 'post',
            url: '/Cyberspace/manage/riskType',
            data: {
                name: "888888" //类型名
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#updateEventType").click(function () {
        $.ajax({
            type: 'put',
            url: '/Cyberspace/manage/riskType/6',
            data: {
                name: "888888" //类型名
            },
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
    $("#getListEventType").click(function () {
        $.ajax({
            type: 'get',
            url: '/Cyberspace/manage/eventType?parentID=0',
            dataType: 'json',
            success: function (data) {
                console.log(data);
            }
        })
    });
</script>
</html>
